var _n56;
var cc__extends = __extends;
var cc__decorate = __decorate;
var cc__importDefault = __importDefault;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $1$Loader = require("Loader");
var s = cc__importDefault($1$Loader);
var $zqcc_OverallSystem = require("zqcc_OverallSystem");
var $1$gameListItem = require("gameListItem");
var l = cc__importDefault($1$gameListItem);
var $1$zqcc_pageBase = require("zqcc_pageBase");
var u = cc__importDefault($1$zqcc_pageBase);
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_gameList = function (t) {
  function _ctor() {
    const instance = null !== t && t.apply(this, arguments) || this;
    instance.pageName = "更多游戏"; // 设置页面名称
    instance.item = null; // 初始化为null
    instance.scrContent = null; // 初始化为null
    instance.listData = null; // 初始化为null
    return instance; // 返回实例
  }
  cc__extends(_ctor, t);
  _ctor.prototype.onLoad = function () { };
  _ctor.prototype.start = function () {
    // 优化后的代码
    const context = this; // 使用const替代var，并修改变量名为更具意义的名称
    s.default.loadBundle("Majiang", function () {
      // 加载关卡JSON资源
      s.default.loadBundleRes("Majiang", "json/guanqia", function (resource) {
        console.log(resource.json); // 打印加载的关卡JSON数据
        const gameData = resource.json; // 使用const替代var并修改变量名为更具意义的名称

        // 确保上下文和节点存在后初始化游戏
        if (context && context.node) {
          context.initGame(gameData);
        }
      });
    }, true, true);

    this._init(); // 初始化其他设置
  };
  _ctor.prototype.initGame = function (t) {
    // 优化后的代码
    this.scrContent.removeAllChildren(); // 清空当前内容

    for (const key in t) { // 使用const替代var，提升可读性
      if (Object.prototype.hasOwnProperty.call(t, key)) {
        const data = t[key]; // 使用const定义数据，提升可读性
        const itemNode = cc.instantiate(this.item); // 实例化项目节点
        itemNode.parent = this.scrContent; // 设置父节点
        itemNode.x = 0; // 设置横坐标为0
        data.key = key; // 将键值赋给数据对象
        itemNode.getComponent(l.default).setData(data); // 设置节点数据
      }
    }
  };
  _ctor.prototype._init = function () {
    this.open();
  };
  _ctor.prototype.OnBtnConfirm = function () { };
  _ctor.prototype.OnBtnClose = function () {
    $zqcc_OverallSystem.mgrs().soundMgr.playBtnSound();
    this.onlyClose();
  };
  cc__decorate([ccp_property(cc.Node)], _ctor.prototype, "item", undefined);
  cc__decorate([ccp_property(cc.Node)], _ctor.prototype, "scrContent", undefined);
  return cc__decorate([ccp_ccclass], _ctor);
}(u.default);
exports.default = def_gameList;